package me.yiyou.meihua.ui.page.sixlines

import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import kotlin.random.Random

class SixLineViewModel : ViewModel() {
    private val _lineArray = mutableStateOf(List(0) { List(0) { 0 } })
    val lineArray: State<List<List<Int>>> = _lineArray

    private val _isGenerate = mutableStateOf(false)
    val isGenerate: State<Boolean> = _isGenerate

    // 创建六次抛硬币结果
    fun createRandomLineArray() {
        _lineArray.value = List(6) {   // 6行
            List(3) {       // 3列
                Random.nextInt(0, 2)  // 生成0或1的随机数
            }
        }
        _isGenerate.value = true
    }
}